param(
    [string] $url = $(Read-Host -Prompt "Enter Url"),
    [string] $template
)

Add-PSSnapin Microsoft.SharePoint.PowerShell | Out-Null

if(($site = get-spsite $url -ErrorAction SilentlyContinue) -ne $null)
{
    Write-Warning "Removing site @ $url"
    Remove-SPSite -Identity $url -Confirm:$false
}

Write-Host "Creating new site @ $url"
if([string]::IsNullOrEmpty($template))
{
    $site = new-spsite -Url $url -HostHeaderWebApplication "http://$($env:computername)" -OwnerAlias "$($env:userdomain)\administrator"	
}
else
{
    $site = new-spsite -Url $url -HostHeaderWebApplication "http://$($env:computername)" -OwnerAlias "$($env:userdomain)\administrator" -Template "$template"
}